<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminUsersIpTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_users_ip', function (Blueprint $table) {
            $table->increments('ui_id');
            $table->bigInteger('user_id')->unsigned()->comment('用户id');
            $table->ipAddress('ip')->nullable()->comment('登录IP');
            $table->tinyInteger('type')->default(1)->comment('ip类型：0禁止登录， 1允许登录');
            $table->integer('amount')->unsigned()->default(1)->comment('登录次数');
            $table->index('user_id');
            //$table->foreign('user_id')->references('user_id')->on('admin_users');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_users_ip');
    }
}
